import Vue from "vue";
import App from "./App.vue";

import io from "socket.io-client";
// 创建 Socket.IO 实例并连接到服务器
// const socket = io("http://localhost:3200");
const socket = io("http://localhost:3200");

import VEmojiPicker from "v-emoji-picker";
Vue.config.productionTip = false;

// 引入路由
import router from "@/router";

// 引入厂库
import store from "@/store";

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";

// 日期处理函数
import { formatDate, computedTime, formatDate2 } from "./utils/dateUtils";

Vue.use(VEmojiPicker);
Vue.use(ElementUI);
Vue.use(socket);
new Vue({
  render: (h) => h(App),
  // 注册路由
  router,
  // 注册仓库
  store,
  // 注册全局事件总线
  beforeCreate() {
    Vue.prototype.$bus = this;
    Vue.prototype.$formatDate = formatDate;
    Vue.prototype.$computedTime = computedTime;
    Vue.prototype.$formatDate2 = formatDate2;
    Vue.prototype.$socket = socket;
    Vue.prototype.$bus = new Vue();
    // Vue.prototype.$API = API;
  },
}).$mount("#app");
